var express = require('express');
var router = express.Router();
var path = require('path');
var config = require('config-lite')(path.resolve(__dirname, '../'));

var checkParams = function(params){
    if(params.corpName && params.name && params.phone && params.email && params.products){
        return true;
    }
    return false;
};

router.post('/', function(req, res, next) {
    var params = req.body;
    //数据完整性校验
    if(!checkParams(params)){
        var header = {'Content-Type': 'text/html;charset=UTF-8'};
        res.writeHead(500, header);
        var result = {
            result:{
                status:1,
                message:'数据不合法'
            }
        };
        res.write(JSON.stringify(result));
        res.end();
        return;
    }
});

module.exports = router;
